<?php
/*
	我的下线
*/
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'main';
$return=array();
$return['pluginset']=$this->plugin_setting('setting');
cfc('core')->checklogin();
if($_RQ['op']=='main'){
	$return['setting']=$this->plugin_setting('page_setting');
	$allmember_num=pdo_count('core_members',array('uniacid'=>$_SESSION['uniacid'],'fromuser'=>$_SESSION['uid']),'id');
	$return['member']['mid']=$_SESSION['uid'];
	$return['member']['member_num']=$allmember_num;
	$return['params']=array('page'=>1,'level'=>1);
	$return['psize']=20;
	$return['list']=array();
	set_html('title','我的直招');
	exi($return);
}
if($_RQ['op']=='list'){
	$params=array('uniacid'=>$_SESSION['uniacid'],'fromuser'=>$_SESSION['uid']);
	$psize=20;
	$pindex=intval($_RQ['page'])?:1;
	$parameter=array(
		'params'=>$params,
		'limit'=>array($pindex,$psize),
		'fields' => array('id','fromuser','username','nickname','avatar','createtime')
	);
	$list=pdo_getlist('core_members',$parameter);
	if(!$list){
		exi('none');
	}
	foreach($list as &$item){
		$item['createtime']=date('Y-m-d H:i:s',$item['createtime']);
		$item['member_num']=pdo_count('core_members',array('uniacid'=>$_SESSION['uniacid'],'fromuser'=>$item['id']),'id');
	}
	exi($list);
}
?>